//
//  ICMSaveReceptionVehicleOrderApi.m
//  ICrEAM
//
//  Created by FoREVer_SaD on 16/11/8.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ICMSaveReceptionVehicleOrderApi.h"

@implementation ICMSaveReceptionVehicleOrderApi
{
    NSMutableDictionary *_dataDic;
}

- (instancetype)initWithDataDic:(NSMutableDictionary *)dic{
    self = [super init];
    if (self) {
        _dataDic = dic;
    }
    return self;
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPost;
}

- (YTKRequestSerializerType)requestSerializerType {
    return YTKRequestSerializerTypeJSON;
}

- (NSURLRequest *)buildCustomUrlRequest {
    NSData *rawData = [NSJSONSerialization dataWithJSONObject:self.requestArgument options:NSJSONWritingPrettyPrinted error:nil];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:self.requestUrl]];
    [request setHTTPMethod:@"POST"];
    [request addValue:@"application/json;charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:rawData];
    return request;
}

// 请求URL
- (NSString *)requestUrl {
    return [NSString stringWithFormat:@"http://%@%@",[[ICreamCache sharedInstance] stringForKey:kIPPath],SaveReceptionCarOrderUrl];
}

// 请求参数
- (id)requestArgument {
    return _dataDic;
}

@end
